package com.ruoyi.web.controller.system;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.HatchetMerchantIncreaseLimit;
import com.ruoyi.system.service.IHatchetMerchantIncreaseLimitService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 信用卡 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-04-23
 */
@Controller
@RequestMapping("/system/hatchetMerchantIncreaseLimit")
public class HatchetMerchantIncreaseLimitController extends BaseController
{
    private String prefix = "system/hatchetMerchantIncreaseLimit";
	
	@Autowired
	private IHatchetMerchantIncreaseLimitService hatchetMerchantIncreaseLimitService;
	
	@RequiresPermissions("system:hatchetMerchantIncreaseLimit:view")
	@GetMapping()
	public String hatchetMerchantIncreaseLimit()
	{
	    return prefix + "/hatchetMerchantIncreaseLimit";
	}
	
	/**
	 * 查询信用卡列表
	 */
	@RequiresPermissions("system:hatchetMerchantIncreaseLimit:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(HatchetMerchantIncreaseLimit hatchetMerchantIncreaseLimit)
	{
		startPage();
        List<HatchetMerchantIncreaseLimit> list = hatchetMerchantIncreaseLimitService.selectHatchetMerchantIncreaseLimitList(hatchetMerchantIncreaseLimit);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出信用卡列表
	 */
	@RequiresPermissions("system:hatchetMerchantIncreaseLimit:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(HatchetMerchantIncreaseLimit hatchetMerchantIncreaseLimit)
    {
    	List<HatchetMerchantIncreaseLimit> list = hatchetMerchantIncreaseLimitService.selectHatchetMerchantIncreaseLimitList(hatchetMerchantIncreaseLimit);
        ExcelUtil<HatchetMerchantIncreaseLimit> util = new ExcelUtil<HatchetMerchantIncreaseLimit>(HatchetMerchantIncreaseLimit.class);
        return util.exportExcel(list, "hatchetMerchantIncreaseLimit");
    }
	
	/**
	 * 新增信用卡
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存信用卡
	 */
	@RequiresPermissions("system:hatchetMerchantIncreaseLimit:add")
	@Log(title = "信用卡", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(HatchetMerchantIncreaseLimit hatchetMerchantIncreaseLimit)
	{		
		return toAjax(hatchetMerchantIncreaseLimitService.insertHatchetMerchantIncreaseLimit(hatchetMerchantIncreaseLimit));
	}

	/**
	 * 修改信用卡
	 */
	@GetMapping("/edit/{iD}")
	public String edit(@PathVariable("iD") String iD, ModelMap mmap)
	{
		HatchetMerchantIncreaseLimit hatchetMerchantIncreaseLimit = hatchetMerchantIncreaseLimitService.selectHatchetMerchantIncreaseLimitById(iD);
		mmap.put("hatchetMerchantIncreaseLimit", hatchetMerchantIncreaseLimit);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存信用卡
	 */
	@RequiresPermissions("system:hatchetMerchantIncreaseLimit:edit")
	@Log(title = "信用卡", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(HatchetMerchantIncreaseLimit hatchetMerchantIncreaseLimit)
	{		
		return toAjax(hatchetMerchantIncreaseLimitService.updateHatchetMerchantIncreaseLimit(hatchetMerchantIncreaseLimit));
	}
	
	/**
	 * 删除信用卡
	 */
	@RequiresPermissions("system:hatchetMerchantIncreaseLimit:remove")
	@Log(title = "信用卡", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(hatchetMerchantIncreaseLimitService.deleteHatchetMerchantIncreaseLimitByIds(ids));
	}
	
}
